package com.example.recruitment.mapper;

import com.example.recruitment.entity.Interview;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface InterviewMapper {
    List<Interview> findAll(Interview query);
    
    Interview findById(Long id);
    
    List<Interview> findByResumeId(Long resumeId);
    
    int insert(Interview interview);
    
    int update(Interview interview);
    
    int deleteById(Long id);
    
    int updateStatus(@Param("id") Long id, @Param("status") String status);
    
    int updateFeedback(@Param("id") Long id, @Param("feedback") String feedback);
    
    long count();
    
    List<Interview> findLatest(int limit);

    @Select("SELECT COUNT(*) FROM interview WHERE DATE(interview_time) = CURDATE()")
    long countTodayInterviews();

    @Select("SELECT COUNT(*) FROM interview WHERE status = 'PASSED' AND type = 'FINAL' AND MONTH(interview_time) = MONTH(CURDATE()) AND YEAR(interview_time) = YEAR(CURDATE())")
    long countMonthlyHires();
} 